package day_2022_12_to_3.year2023;

/**
 * @author haomin
 * @date 2023/02/06 23:18
 **/
public class Day2_6_Num2331 {
    class Solution {
        public boolean evaluateTree(TreeNode root) {
            if(root.left == null && root.right == null){
                return root.val == 0?false:true;
            }
            //处理节点，树为完整二叉树，两孩子都有
            boolean left = evaluateTree(root.left);
            boolean right =  evaluateTree(root.right);
            return root.val == 2?left|right:left&right;
        }
    }
}